package org.abratuhi.kvngroupware.dalgen;

import java.awt.event.ActionEvent;
import java.util.Properties;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.border.TitledBorder;

import org.abratuhi.kvngroupware.KVNGroupwareClientAction;
import org.abratuhi.kvngroupware.network.MessageSender;
import org.abratuhi.kvngroupware.widget.AbstractUIWidget;
import org.jdom.Element;

@SuppressWarnings("serial")
public class DalgenWidget extends AbstractUIWidget{
	JButton btnGenerate = new JButton();

	public DalgenWidget(String frametitle, MessageSender sender,
			Properties locale, DalgenManager dalgenmanager) {
		super(frametitle, sender, locale, dalgenmanager);
		frametitle = locale.getProperty("main.menuitem.dalgen");
		datapanel.setBorder(new TitledBorder(locale.getProperty("dalgen.widget.border.words")));
		btnGenerate.setAction(new GenAction(locale.getProperty("dalgen.widget.button.generate"), null, null, null));
		buttonpanel.add(btnGenerate);
		
	}

	@Override
	public void onFrameClose() {
	}
	
	class GenAction extends KVNGroupwareClientAction{

		public GenAction(String text, ImageIcon icon, String desc,
				Integer mnemonic) {
			super(text, icon, desc, mnemonic);
		}

		@Override
		public void actionPerformed(ActionEvent e) {
			sender.sendMessage(sender.createMessage("type,action", "dalgen,get", "", new Element[0]));
		}
		
	}

}
